<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>v-for</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
<ul id="app">
    <li v-for="item in fruits">
        {{ item}}
    </li>


    <li v-for="(item ,index) in myFruits" :key="index">
        {{ item.cname}} {{item.ename}} ---{{index}}
    </li>


    <li v-for="(value,key,index ) in obj">
        {{value+'---'+key+'---'+index}}
    </li>

    <li v-for="(value,key,index ) in obj" v-if="key=='age'">
        {{value+'---'+key+'---'+index}}
    </li>

</ul>

<script>
    var app = new Vue({
        el: '#app',
        data: {
            fruits: ['苹果', '香蕉', '橘子'],
            myFruits: [
                {
                    ename: 'apple',
                    cname: '苹果'
                },
                {
                    ename: 'banana',
                    cname: '香蕉'
                },
                {
                    ename: 'orange',
                    cname: '橘子'
                }],
            obj:{
                name:'hk',
                age:30,
                hobby:'women'
            }
        }
    })
</script>

</body>
</html>